const Koa = require('koa')
const path = require('path')
const helmet = require('koa-helmet')
const koaBody = require('koa-body')
const cors = require('@koa/cors')
const json = require('koa-json')
const statics = require('koa-static')
const compose = require('koa-compose')
const app = new Koa();
const router = require('./routes/routes')

const middleware = compose([
  koaBody(),
  statics(path.join(__dirname, '../public')),
  cors(),
  json({ pretty: false, param: 'pretty' }),
  helmet(),
])
app.use(middleware)
app.use(router())

app.listen(3000)